<template>
  <div>
    <h4>值是: {{number}}</h4>
    <button @click="changeVal">改变值</button>
  </div>
</template>

<script>
export default {
  data(){
    return{
      // number:22
    }
  },
  props:['number'],
  methods:{
    changeVal(){
      this.$emit('update:number', this.number+2)
    }
  }
}
</script>

<style scoped>
div{
  background-color: orange;
}
</style>